
import Vue from 'vue'
import Vuex, { Store } from 'vuex'
import { State,Getters } from './plugin/types/store';
import base from './store_module/base';

// #region vuex状态的类型定义

declare module '@/plugin/types/store' {
    interface State {
        /** 测试标题 */
        test_title: string
    }
}

// #endregion

Vue.use(Vuex)

let x = {
    state: {
        test_title: "测试 20190319_164314"
    },
    getters: {
        new_title(state: State, getters: Getters, rootState: State, rootGetter: any): string {
            return "-- " + state.test_title;
        }
    },
} as any;

export default new Vuex.Store({
    
    // 所有该状态下的模块都在该处引入。
    modules: {
        base
    },
    // mutations: {
    //     set_test_title(state: State, value: string) {
    //         state.test_title = value;
    //     }
    // },
    ...x
}) as Store<State>
